using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ClickNET;
using ClickNET.Imaging;

public partial class viewimage : ClickNET.Web.UI.Page
{
    private string m_fileName;
    private string m_galleryName;
    private Picture m_picture;

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        this.TryLoadPicture();
        this.BindControls();
    }

    public void TryLoadPicture()
    {
        this.m_galleryName = Request["galleryName"];
        this.m_fileName = Request["fileName"];

        if (!String.IsNullOrEmpty(this.m_galleryName) && !String.IsNullOrEmpty(this.m_fileName))
        {
            Gallery g = FileSystemGalleryManager.LoadGallery(this.m_galleryName);

            this.m_picture = g.Pictures.Find(delegate(Picture p) { return p.FileName.Equals(this.m_fileName); });
        }
    }

    public void BindControls()
    {
        if (null != this.m_picture)
        {
            this.c_singleImageView.Picture = this.m_picture;
        }
    }
}
